package com.demo.io;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;

// ScanXan.class.getResource("/").getPath();
// ScanXan.class.getResource("").getPath();
// (new File("")).getCanonicalPath();
// System.getProperty("user.dir");
public class ScanXan {
    public static void main(String[] args) throws IOException {

        Scanner s = null;

        try {
            s = new Scanner(new BufferedReader(new FileReader(System.getProperty("user.dir") + "\\java-io\\example\\xanadu.txt")));
            while (s.hasNext()) {
                System.out.println(s.next());
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } finally {
            if (s != null) {
                s.close();
            }
        }
    }
}
